Solving 10385 - Duathlon (Ternary search)
[andmenj-acm.git] / 455 - Periodic Strings / 455.cpp
blob69fb10c565abe48c0daa08cd3f574e648185bda9
1 #include <cstdlib>
2 #include <iostream>
3 #include <string>
5 using namespace std;
7 int main(int argc, char *argv[])
9 int casos, posibleP;
10 bool firstCase = true;
11 cin >> casos;
12 while (casos--){
13 if (!firstCase) cout << endl;
14 firstCase = false;
15 string ppal, semi, periodo;
16 cin >> ppal;
17 posibleP = 0;
18 do{
19 posibleP++;
20 periodo = semi = ppal.substr(0, posibleP);
21 while (semi.length() < ppal.length()){
22 semi += periodo;
24 } while (semi != ppal);
25 cout << posibleP << endl;
27 return 0;